package com.lh.controller;

import com.fasterxml.jackson.databind.annotation.JsonAppend;
import com.lh.Service.BrandService;
import com.lh.Service.CategoryService;
import com.lh.Service.Impl.BrandServiceImpl;
import com.lh.bean.Brand;
import com.lh.bean.Category;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;



@Controller
@RequestMapping("/menu")
public class MenuController {
    @Resource
    private CategoryService categoryService;

    /**
     * 分类
     * @param request
     * @return
     */
    @RequestMapping("/categoryList")
    @ResponseBody
    public List<Category> queryCategoryList(HttpServletRequest request){
        List<Category> categoryList = categoryService.queryCategoryList();
//        request.setAttribute("categoryList",categoryList);
        return categoryList;
    }

    /**
     * 品牌
     */
    @Resource
    private BrandService brandService;
//    @RequestMapping("/brandList1")
//    @ResponseBody
//    public List<Brand> queryBrandList(){
//        return brandService.queryBrandList();
//    }

    @RequestMapping("/brandList")
    @ResponseBody
    public List<Brand> queryBrandByCategoryName(String category_id){
        return  brandService.queryBrandByCategoryName(category_id);
    }








}
